﻿using VisualWip.Core;
using VisualWip.Core.Columns;
using VisualWip.Core.Interfaces;

namespace VisualWip.TFS2010Providers
{
    public class TfsWorkDoingDoneSettingsViewModel :
        TfsWorkDualQuerySettingsViewModelBase<WorkDoingDoneColumn>
    {
        public TfsWorkDoingDoneSettingsViewModel(Application application, WorkDoingDoneColumn column,
                                                 IWorkItemProviderFactory workItemProviderFactory,
                                                 IWorkItemSizeProvider workItemSizeProvider,
                                                 IColumnTypeProvider columnTypeProvider)
            : base(application, column, workItemProviderFactory, workItemSizeProvider, columnTypeProvider)
        {
        }

        public override string SettingsWindowName
        {
            get { return "Doing done column"; }
        }

        protected override void DownloadDisplayFieldsOnlyHasChanged()
        {
            var firstQuery = Column.FirstQuery as WorkItemQueryBase;
            var secondQuery = Column.SecondQuery as WorkItemQueryBase;

            if (firstQuery != null)
                firstQuery.DownloadDisplayFieldsOnly = DownloadDisplayFieldsOnly;
            if (secondQuery != null)
                secondQuery.DownloadDisplayFieldsOnly = DownloadDisplayFieldsOnly;
        }
    }
}